<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户牲畜信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/livestockinfo/userLivestockInfo/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="#">用户牲畜信息列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="userLivestockInfo" action="${ctx}/livestockinfo/userLivestockInfo/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>用户名：</label>
				<form:input path="userinfo.username" htmlEscape="false" maxlength="20" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix">
			 <input id="btnExport" class="btn btn-primary" type="button" value="导出"/> 
			</li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>用户</th>
				<!-- 牲畜类型 -->
				<c:forEach items="${stocklist}" var="stock">
					<th>${stock.label}</th>
				</c:forEach>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="userLivestockInfo">
			<tr>						
				<td>${userLivestockInfo.userinfo.username }</td>
				<c:forEach items="${stocklist}" var="stock">
					<td>
					<c:forEach items="${userLivestockInfo.stockList}" var="stocklit">
						<c:choose>
						<c:when test="${stock.value ==  stocklit.livestockType}">
							${stocklit.count}</td>
						</c:when>
						<c:otherwise></c:otherwise>
						</c:choose>	 					
 					</c:forEach>
				</c:forEach>						
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>